Imports System.Diagnostics
Imports System.Reflection
Imports System.Windows.Forms

Public Class frmSplash

#Region "Public Static Properties"

#End Region

#Region "Private Delegates"

   Private Delegate Sub SetControlTextHandler(ByVal iControl As Control, _
                                              ByVal iText As String)

#End Region

#Region "Private Fields"

   Private mMessage As String

#End Region

#Region "Public Properties"

   Public Property Message() As String
      Get
         Return mMessage
      End Get
      Set(ByVal value As String)
         mMessage = value
         Me.SetControlText(Me.lblMessage, Me.TrimMessage(value))
      End Set
   End Property

#End Region

#Region "Private Functions"

   Private Function TrimMessage(ByVal iMessage As String) As String
      If iMessage.Length > 300 Then Return iMessage.Substring(0, 300) & "..."
      Return iMessage
   End Function

   Private Sub SetControlText(ByVal iControl As Control, _
                              ByVal iText As String)
      If Me.InvokeRequired Then
         Me.Invoke(New SetControlTextHandler(AddressOf SetControlText), _
                   New Object() {iControl, iText})
      Else
         iControl.Text = iText
      End If
   End Sub

#End Region

   Private Sub frmSplash_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      Dim fv As FileVersionInfo
      fv = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location)
      Me.lblTitle.Text = fv.FileDescription
      Me.lblVersion.Text = fv.FileVersion
      Me.lblCopyright.Text = fv.LegalCopyright
   End Sub

End Class

